#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
int countdigit(int number, int digit) {
	int count = 0;
	if (number == 0 && digit == 0) {
		count = 1;
	}
	while (abs(number) > 0) {
		if (abs(number % 10) == digit) {
			count++;
		}
		number /= 10;
	}
	return count;
}
int main()
{
	int num, n;
	scanf("%d %d", &num, &n);
	int i = countdigit(num, n);
	printf("Number of digit %d in %d: %d", n, num, i);
	return 0;
}